home *** CD-ROM | disk | FTP | other *** search
- /*
- Search for duplicate file names
- © 1995 John Kennedy
- */
-
- address command /* Use AmigaDOS */
-
- /* First, generate list of files & sizes */
-
- Say "Making list of all files in current directory...."
-
- 'list lformat "%n %l %p" all files > t:templist'
-
-
-
- /* Now, go though searching for duplicates */
-
- Say "Searching for duplicates...."
-
- infile1='infile1'
- infile2='infile2'
- outfile='outfile'
-
- call open(outfile,'t:report','w')
-
- call open(infile1,"t:templist",'r')
-
- do while ~eof(infile1)
- data1=readln(infile1)
- parse var data1 name1 " " size1 " " path1
-
- call open(infile2,"t:templist",'r')
- do while ~eof(infile2)
-
- data2=readln(infile2)
- parse var data2 name2 " " size2 " " path2
-
- if ((name1=name2 & size1=size2) & (path1~=path2)) then do
- call writeln(outfile,name1||" "||path1)
- end
- end
- call close(infile2)
- end
- call close(infile1)
- call close(outfile)
-
- /* Now process the report file a little further */
-
- /* Let's start by sorting it... */
-
- Say "Sorting report file..."
-
- 'sort t:report t:report2'
-
- /* Now display report, removing multiple files */
-
- say
- say "Duplicate File Search Report"
- say "----------------------------"
- say
-
- call open(infile1,"t:report2",'r')
-
- name2=''
- path2=''
-
- do while ~eof(infile1)
- data1=readln(infile1)
- parse var data1 name1 " " path1
-
- if (name1~=name2) then
- say
-
- if (name1~=name2 | path1~=path2) then
- say path1||name1
-
- name2=name1
- path2=path1
- end
-
- call close(infile1)
-
- /* All done! */
-
- 'delete "t:report" quiet'
- 'delete "t:report2" quiet'
- 'delete "t:templist" quiet'
-
- Say "All finished!"
-
-